package com.keepmoving.service.impl;

import com.keepmoving.dao.OrderDao;
import com.keepmoving.po.Coach;
import com.keepmoving.po.Order;
import com.keepmoving.service.OrderService;
import com.keepmoving.vo.CountUser;
import com.keepmoving.vo.CourseOrder;
import org.junit.Test;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.sql.Timestamp;
import java.util.List;

/**
 * @author 魏范彬
 * @author gyy
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Resource
    OrderDao orderDao;

    @Test
    public void test(){
        int[] i = {10003};
        System.out.println(delete(i));
    }


    @Override
    public List<Order> findAll() {
        return orderDao.findAll();
    }

    @Override
    public List<Order> findBylId(int lId) {
        return orderDao.findBylId(lId);
    }

    @Override
    public Order findByoId(int oId) {
        return orderDao.findByoId(oId);
    }

    @Override
    public boolean insert(Order order) {
        order.setOrderDate(new Timestamp(System.currentTimeMillis()));
        return orderDao.insert(order)>0?true:false;
    }

    @Override
    public boolean delete(int[] oIds) {
        return orderDao.delete(oIds)>0?true:false;
    }

    @Override
    public boolean deleteOrder(int[] oIds) {
        return orderDao.deleteOrder(oIds)>0?true:false;
    }

    @Override
    public boolean deleteByoId(int oId) {
        return orderDao.deleteByoId(oId)>0?true:false;
    }

    @Override
    public boolean update(Order order) {
        return orderDao.update(order)>0?true:false;
    }

    @Override
    public List<CourseOrder> findByCourseByCid(int cId) {
        return orderDao.findByCourseByCid(cId);
    }

    @Override
    public List<CourseOrder> findByCourseBylId(int lId) {
        return orderDao.findByCourseBylId(lId);
    }

    @Override
    public List<CourseOrder> findByCourse() {
        return orderDao.findByCourse();
    }

    @Override
    public List<CountUser> findCount() {
        return orderDao.findCount();
    }
}
